package com.wellwan.cloud.feignclient;

import com.wellwan.cloud.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * Copyright (C),微动天下
 * FileName: FeignClientFallBack
 * Author:   maokai
 * Date:     2020/2/29 11:06
 * Description: 回退类需实现FeignClient 接口
 */
//@Component
@Slf4j
public class FeignClientFallBack implements UserFeignClient {
    @Override
    public User findById(Long id) {
        log.error("异常信息------->{}","默认用户");
        User user = new User();
        user.setId(-1L);
        user.setName("默认用户");
        return user;
    }

    @Override
    public String handleFileUpload(MultipartFile file ) {
        String errorMessage = "上传文件失败";
        log.error("异常信息------->{}",errorMessage);
        return errorMessage;
    }
}
